﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace InSafetyAirClient.GUI.Airline
{
    public partial class ListA : UserControl
    {

        List<InSafetyAirClient.InSafetyAirService.AirLine> aips = null;

        public ListA()
        {
            InitializeComponent();
        }

        private void populateList()
        {
            DataTable dataTable1 = new DataTable();
            dataTable1.Columns.Add("Company Name", typeof(string));
            ServiceSingle servS = ServiceSingle.Instance;
            aips = servS.getService().GetAll(typeof(InSafetyAirClient.InSafetyAirService.AirLine).Name).OfType<InSafetyAirClient.InSafetyAirService.AirLine>().ToList();
            foreach (InSafetyAirService.AirLine aip in aips)
            {
                dataTable1.Rows.Add(aip.name);
            }
            dataGridView1.DataSource = dataTable1;
        }

        private void ListA_Load(object sender, EventArgs e)
        {
            if (!this.DesignMode)
            {
                populateList();
            }
        }
    }
}
